// xc_lshop/shop/user/transfer/record.js
var actbill = require('../../model/order_bill')

Page({
  mixins: [require('../../../../xc/mixins/basicMixin')],

  /**
   * 页面的初始数据
   */
  data: {

  },
  xcloaddata: function (options, config) {



    var that = this;
    that.getpagelist(that, 1)
  },

  getpagelist(that, rest, strwhere) {
    if (rest == 1) {
      if (!strwhere) {
        strwhere = {}
      }
      strwhere['auth'] = 'user';
      strwhere["status"] = 9;
      strwhere["ordertype"] = 19;
      strwhere["amountrecord"] = 1;

      that.setData({
        modellist: [],
        isempty: false
      });
    }
    actbill.offset(that, rest, strwhere).then(function (result) {
      var updatemdoel = {};
      if ((result["code"] == "over" && result["obj"]) || result["code"] == "loadmore") {
        if (result["obj"]["modellist"].length < 1) {
          updatemdoel["isempty"] = true
        } else if (rest == 1) {
          updatemdoel["modellist"] = result["obj"]["modellist"];
        } else {
          if (result["obj"]["modellist"].length > 0) {
            updatemdoel["modellist"] = that.data.modellist.concat(result["obj"]["modellist"]);
          }
        }
      }
      // that.selectComponent("#ordercomment").showmodel( updatemdoel["modellist"][0],"order")      
      wx.stopPullDownRefresh();
      that.setData(updatemdoel);
    }, function () {

    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    var that = this;
    that.getpagelist(that, -1)
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})